package snl;

import java.awt.Point;
import java.awt.Rectangle;

public class BoardCell {
	private String number;
	private Rectangle box;

	public String getNumber() {
		return number;
	}
	public void setNumber(String number) {
		this.number = number;
	}

	public Rectangle getBox() {
		return box;
	}
	public void setBox(Rectangle box) {
		this.box = box;
	}
	public BoardCell create(int i, int j) {
		BoardCell cell = new BoardCell();
		int x = j * 64;
		int y = 640 - ((i+1) * 64);
		cell.setBox(new Rectangle(x, y, 64, 64));
		cell.setNumber(String.valueOf(fetchNumber(i, j)));
		return cell;
	}
	public Point getNumberPosition(){
		Point center = new Point();
		center.x = (int) box.getCenterX();
		center.y = (int) box.getCenterY();
		return center;
		
	}
	
	private int fetchNumber(int i, int j){
		int lhs = i * 10 + j + 1;
		int rhs = (9 - j * 2) * (i % 2);
		return lhs + rhs;
	}
}
